package huanzhao.erp.domain.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import huanzhao.erp.domain.types.BillType;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

@TableName(value ="bill")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Bill implements Serializable {

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;


    @TableField(value = "time")
    private Date time;

    /**
     * 是否为收入
     */
    @TableField(value = "revenue")
    private Boolean revenue;

    /**
     * 收支类型
     */
    @TableField(value = "type")
    private BillType type;

    /**
     * 金额
     */
    @TableField(value = "amount")
    private BigDecimal amount;

    @Serial
    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    public Bill(boolean revenue, BillType type, BigDecimal amount) {
        this.revenue = revenue;
        this.type = type;
        this.amount = amount;
    }
}